﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Code.Models;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace Company.Web.Areas.Manage.Models.ProductModels
{
    public class IndexModel
    {
        public int? ID { get; set; }
        /// <summary>
        /// 分页，页码
        /// </summary>
        public int? A { get; set; }
        /// <summary>
        /// 分页，每页个数
        /// </summary>
        public int? B { get; set; }
        public bool? S { get; set; }
        public int SumCount { get; set; }
        public IndexSerchModel Serch { get; set; }
        public ProductItem[] Products { get; set; }
        public List<ProductTypeItem> Parents { get; set; }
        public List<ProductTypeItem> Childs { get; set; }
        public IEnumerable<ProductType> Types { get; set; }
    }

    public class IndexSerchModel
    {
        public string Number { get; set; }
    }

    public class ProductItem
    {
        public long ID { get; set; }
        public string Number { get; set; }
        public string Name_En { get; set; }
        public string Name_Ch { get; set; }
        public string DefaultPic { get; set; }
        public int TypeID { get; set; }
        public string TypePath { get; set; }
    }

    public class ProductEditModel
    {
        public IEnumerable<ProductType> Types { get; set; }
        public string Action { get; set; }
        public long? ID { get; set; }
        public string Number { get; set; }
        [Required(ErrorMessage = "请指定产品所属分类")]
        public int? TypeID { get; set; }
        public string Name_En { get; set; }
        public string Name_Ch { get; set; }
        public string TypeName_En { get; set; }
        public string TypeName_Ch { get; set; }
        public int? ClickCount { get; set; }
        public NameValueItem<string, string>[] Disc_En { get; set; }
        public NameValueItem<string, string>[] Disc_Ch { get; set; }
        [Required(ErrorMessage = "请至少要上传一张产品图片")]
        public PictureItem[] Pictures { get; set; }

        public IEnumerable<ProductPictureType> PictureTypes { get; set; }
    }

    public class PictureItem
    {
        public long? ID { get; set; }
        public string FileName { get; set; }
        public bool? IsDefault { get; set; }
        public bool? IsNew { get; set; }
        public bool? IsDel { get; set; }
        public int TypeID { get; set; }
    }

    public class ProductTypeItem
    {
        public int ID { get; set; }
        public string Name_Ch { get; set; }
        public string Name_En { get; set; }
        public string Parents { get; set; }
        public int? ParentID { get; set; }
        public int ProductCount { get; set; }
    }

    public class ProductTypeModel
    {
        public int? ID { get; set; }
        public ProductTypeEditModel ProductType { get; set; }
        public List<ProductType> Parents { get; set; }
        public List<ProductType> Childs { get; set; }
        public IEnumerable<ProductType> Types { get; set; }
    }

    public class ProductTypeEditModel
    {
        public string Model { get; set; }
        public int? ID { get; set; }
        [Required(ErrorMessage = "请输入中文名")]
        public string Name_Ch { get; set; }
        [Required(ErrorMessage = "请输入英文名")]
        public string Name_En { get; set; }
        public int? ParentID { get; set; }
    }

    public class PictureTypeModel
    {
        public IEnumerable<ProductPictureType> Types { get; set; }
    }

    public class PictureTypeEditModel
    {
        public int? TypeID { get; set; }
        [Required(ErrorMessage = "请输入中文名称")]
        public string Name_En { get; set; }
        [Required(ErrorMessage = "请输入英文名称")]
        public string Name_Ch { get; set; }
        public bool? IsDefault { get; set; }
        public string Model { get; set; }
    }
}